COLLEGE OF ENGINEERING AND INFORMATION TECHNOLOGY

SECOND Semester, AY 2021-2022

TEST QUESTIONNAIRE 

MIDTERM Examination in AC3/AC4 – OBJECT ORIENTED PROGRAMMING 

 

 

Direction:  This exam covers Modules in Midterm (40 points). Please answer in a sheet of paper and take picture then turned in.  This is due at 7:30-9:00am.  Those late submission can still be accepted but with deductions. Strictly NO DUPLICATION OF ANSWERS.

 

  1.  ANALYSIS (Module 1):  Analyze and answer the question

1-5    Completely distinguish procedural and object oriented in terms of programming methods.  

In procedural programming, the program is divided into small parts called functions. In object-oriented programming, the program is divided into small parts called objects. Procedural programming follows a top-down approach. Object-oriented programming follows a bottom-up approach.

6-10 Comprehensively evaluate encapsulation, abstraction, inheritance and polymorphism based on the principles of object-oriented programming;

            

There are three more important concept, inheritance, which makes the OOP code more modular, easier to reuse and build a relationship between classes. Encapsulation can hide some of the private details of a class from other objects, while polymorphism can allow us to use a common operation in different ways.

 

 

 

  1. EVALUATION (Module 2) : Evaluate and answer the question

11-20 Broadly summarize the concepts of unified modeling language (UML), the standard approach for modeling a system in the object-oriented world.

Unified modeling language (UML) provides a standardized set of tools to document the analysis and design of a software system. UML is fundamentally based on an object-oriented technique known as use case modeling. A use case model describes what a system does without describing how the system does it.

  1. ANALYSIS (Module 3): Analyze the following statements.  Write the letter of the correct answer in your paper.   Write 

Answer: b

a.         If a supports the statement.

b.         If b supports the statement.

c.         If a and b support the statement.

d.         Neither a nor b supports the statement.

 

Questions:

21.  The use of the correct String declaration to declare the String of txt  “Good   Morning”

Answer: a

 

a.  String =   “Good Morning”;                     b.   string =  “Good Morning”;          

22.  The use of the correct operator to concatenate two strings: String one = “One” and String two = “Two”.

Answer: b

 

a.   System.out.println(One + two)  b. System.out.println(One + Two) 

23.    Declaring Variable Syntax is :

Answer: a

 

           a. type variable = value;                              b. variable = value;

24.  Creating  a variable called name of type string and assign it the value "John":         

Answer: a

 

           a.   String name = John;                              b. String name = “John";

25.  Creating a variable called Num of type int and assign it the value 50.

Answer: a

 

a. int Num = 50;                                            b. int Num = “50”;

26.  Creating a variable called num of type double and assign it the value of 100.00

Answer: b

 

            A.  int num = 100;                                       b.  double num = 100.00;

27.  The Rules for Declaring Variables in Java

Answer: b

 

a. Variable name must bound with data type. It means while
 declaring a variable we must specify its data type.

b. Reserve word or keywords cannot be taken as a variable
 name.

28. The types of variables in Java 

Answer: a


 a. instance              b.  local 

29. Consider the item below 

Answer: b

 

if (condition)

    {

         … (if block)

}

This means the

  1.  correct syntax of the if statement
  2.  correct but lacking syntax of the if statement
  3. Consider the item below

Answer: a

 

System.out.println("Old Price of Iron: "+PRICE);  which means

  1. The screen prints out Old Price of Iron:  with the value of the PRICE
  2. The screen prints only the value of the PRICE

EVALUATION (Module IV).  Evaluate the item below

31-40.  Comprehensively evaluate the array with its declaration, initialization and accessing the elements.  You can give examples for your evaluation.

 

Answer

 

 An array can be initialized to a particular size. In this case, the default value of each element is 0.

class HelloWorld { 

public static void main( String args[] ) {

 //Array Declaration

 int[] array;

 //Array Initialization

 array = new int[]{1,2,3,26,15}; 

{ System.out.println(array[2]); } } }

Output: 3